//
//  AVCaptureDevice+Shortcut.m
//  Musical.ly
//
//  Created by Song on 14-3-5.
//  Copyright (c) 2014年 微琦文化. All rights reserved.
//

#import "AVCaptureDevice+LLShortcut.h"


@implementation AVCaptureDevice (LLShortcut)

+ (AVCaptureDevice *)ll_rearCamera
{
    AVCaptureDevice *backendCamera;

    NSArray *devices = [AVCaptureDevice devices];

    for (AVCaptureDevice *device in devices) {
        if ([device hasMediaType:AVMediaTypeVideo]) {
            if ([device position] == AVCaptureDevicePositionBack) {
                backendCamera = device;
            }
        }
    }
    return backendCamera;
}


+ (AVCaptureDevice *)ll_frontCamera
{
    AVCaptureDevice *frontCamera;

    NSArray *devices = [AVCaptureDevice devices];

    for (AVCaptureDevice *device in devices) {
        if ([device hasMediaType:AVMediaTypeVideo]) {
            if ([device position] == AVCaptureDevicePositionFront) {
                frontCamera = device;
            }
        }
    }
    return frontCamera;
}


@end
